const baseUrl = 'http://tubao.cddcjt.com.cn'
const addons = '/addons/emoticon/'


const request = (url = '', date = {}, type = 'GET', header = {'token':""}) => {
	
	const token = uni.getStorageSync('token')
	header.token = token;
	// uni.showToast({
	// 	title: token
	// });
    return new Promise((resolve, reject) => {
        uni.request({
            method: type,
            url: baseUrl + addons + url,
            data: date,
            header: header,
            dataType: 'json',         
        }).then((response) => {
            setTimeout(function() {
                uni.hideLoading();
            }, 200);
            let [error, res] = response;        
            resolve(res.data);
        }).catch(error => {
            let [err, res] = error;
            reject(err)
        })
    });
}
export default request